<template>
  <div>
    <div class="top">
      <div class="top1">
        <span>每满2件减20元</span>
        <span>规则详情 &gt;</span>
      </div>
      <div class="top2">
        <span>距结束还剩247天&nbsp;</span>
        <van-count-down :time="time">
          <template #default="timeData">
            <span class="block">{{ timeData.hours }}</span>
            <span class="colon">:</span>
            <span class="block">{{ timeData.minutes }}</span>
            <span class="colon">:</span>
            <span class="block">{{ timeData.seconds }}</span>
          </template>
        </van-count-down>
      </div>
    </div>

    <div class="box">
      <section class="list" v-for="(v, i) in arra" :key="i">
        <img :src="v.img" />
        <div class="mingxi">
          <p>[完美日记]至臻柔色丝绒唇釉「天鹅绒」唇釉 锦鲤色</p>
          <p>好评率100%</p>
          <div class="price">
            <div><span>￥59.90</span></div>
            <div class="iconfont">购</div>
          </div>
        </div>
      </section>
    </div>
  </div>
</template>

<script>
import getlink from "@/apis/getapi.js";
export default {
  data() {
    return {
      arr: "",
    };
  },
  computed: {
    arra() {
      return this.arr.slice(0, 6);
    },
  },
  mounted() {
    getlink("/data/list/lists").then((ok) => {
      console.log(ok.data.data);
      this.arr = ok.data.data;
    });
  },
  activated() {
    confirm("抢购即将结束，请抓紧时间选购");
  },
  deactivated() {
    confirm("已经选好了吗");
  },
};
</script>

<style scoped>
.colon {
  display: inline-block;
  margin: 0 4px;
  color: #ee0a24;
}
.block {
  display: inline-block;
  width: 22px;
  color: #fff;
  font-size: 12px;
  text-align: center;
  background-color: #cacaca;
}
.top {
  height: 1.4rem;
  line-height: 0.25rem;
  background-image: linear-gradient(
    to bottom,
    red 20%,
    rgb(230, 92, 38) 50%,
    rgba(202, 102, 21, 0.014) 100%
  );
  color: white;
  padding-left: 0.2rem;
  padding: 0.1rem 0 0 0.2rem;
  position: relative;
}
.top1 {
  display: flex;
  justify-content: space-between;
  font-size: 0.16rem;
}
.top1 span:nth-child(2) {
  width: 0.8rem;
  text-align: center;
  font-size: 0.14rem;
  border-radius: 0.15rem 0 0 0.15rem;
  background-color: rgba(197, 87, 87, 0.931);
}
.top2 {
  display: flex;
}
.box {
  position: absolute;
  top: 1.5rem;
  width: 3.2rem;
  margin: 0.1rem 0.18rem;
  border-radius: 0.2rem;
  padding: 10px 10px;
  border: 0.02rem solid rgba(128, 128, 128, 0.151);
  box-shadow: 0.05rem 0.03rem rgba(231, 230, 230, 0.37);
}
.list {
  width: 3.2rem;
  height: 1.05rem;
  margin-bottom: 0.1rem;
  display: flex;
  justify-content: space-between;
  background-color: white;
}
.list img {
  width: 0.85rem;
  height: 0.85rem;
}
.list .mingxi {
  width: 1.8rem;
}
.price {
  display: flex;
  justify-content: space-between;
  margin-top: 0.2rem;
  height: 27px;
  line-height: 27px;
}
.mingxi p:nth-child(1) {
  font-weight: 600;
  line-height: 0.18rem;
}
.mingxi p:nth-child(2) {
  color: rgb(238, 130, 8);
  font-weight: 600;
}
.price span:nth-child(1) {
  color: red;
  font-size: 0.2rem;
  font-weight: 600;
}
.price div:nth-child(2) {
  font-weight: 600;
  width: 0.3rem;
  height: 25px;
  line-height: 0.25rem;
  text-align: center;
  background-color: red;
  color: white;
  border-radius: 0.2rem;
}
</style>